﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace 门诊管理系统
{
    public partial class jiuyijilu : Form
    {
        public jiuyijilu()
        {
            InitializeComponent();
        }

        private void jiuyijilu_Load(object sender, EventArgs e)
        {
            lab_xm.Text = txb.xm;
            lab_id.Text = txb.id;
            lab_idcard.Text = txb.idcard;
            SqlConnection sqlConnection = new SqlConnection();
            sqlConnection.ConnectionString =
                 ConfigurationManager.ConnectionStrings["connect"].ConnectionString;
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.Connection = sqlConnection;
            sqlCommand.CommandText = "SELECT * FROM tb_jiuyijilu;";
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
            sqlDataAdapter.SelectCommand = sqlCommand;
            DataTable jiuyiTable = new DataTable();
            sqlDataAdapter.Fill(jiuyiTable);
            sqlConnection.Close();
            this.dgv_jiuyi.Columns.Clear();
            this.dgv_jiuyi.DataSource = jiuyiTable;
            this.dgv_jiuyi.Columns["jiuyidate"].HeaderText = "病案号";
            this.dgv_jiuyi.Columns["jiuyijilu"].HeaderText = "住院日期";
            this.dgv_jiuyi.Columns["doctorname"].HeaderText = "出院日期";
            this.dgv_jiuyi.Columns["doctorno"].HeaderText = "病历采集日期";
            this.dgv_jiuyi.Columns[this.dgv_jiuyi.Columns.Count - 1].AutoSizeMode =
               DataGridViewAutoSizeColumnMode.Fill;
        }
    }
}
